/**
 * Copyright 2019 Inc.
 **/
package com.myz.service.feign.feign;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 用于服务降级 FallbackFactory,异常信息处理
 *
 * @author maoyz0621 on 19-9-11
 * @version: v1.0
 */
// 不要遗忘注解
@Component
public class ScheduleServiceFallbackFactory implements FallbackFactory<ScheduleService> {

    @Override
    public ScheduleService create(Throwable cause) {
        return new ScheduleService() {

            @Override
            public String index() {
                return "this is FallbackFactory";
            }

            @Override
            public String get(Integer id) {
                return "this is FallbackFactory";
            }

            @Override
            public String header(String secret, String username) {
                return null;
            }

            @Override
            public String error(String username) {
                return "error FallbackFactory";
            }

            @Override
            public String url404() {
                return null;
            }
        };
    }
}
